﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Rocket.Data;
using Rocket.Bll.Models;
using Rocket.Windows.Framework;
using Rocket.Core;

namespace Rocket.Bll
{
    public class HandlerReaderApplication : BaseHandler<ReaderApplicationView
        , ReaderApplication>
    {
        public HandlerReaderApplication()
            : base(RocketRepository<ReaderApplication>.Instance)
        {
        }

        protected override Type LogPrefix
        {
            get { return this.GetType(); }
        }

        public override void ForwardMap(AutoMapper.IMappingExpression<ReaderApplicationView
            , ReaderApplication> mappingExpression)
        {
            mappingExpression
                 //.ForMember(dest => dest.ApplicationTypeId, opt => opt.MapFrom(src => (ReaderApplicationTypes)src.ApplicationTypeId))
                 .ForMember(dest => dest.ReaderApplicationId, opt => opt.MapFrom(src => src.Id));
        }

        public override void BackwardMap(AutoMapper.IMappingExpression<ReaderApplication
            , ReaderApplicationView> mappingExpression)
        {
            mappingExpression
                //.ForMember(dest => dest.ApplicationTypeId, opt => opt.MapFrom(src => (int)src.ApplicationTypeId))
                .ForMember(dest => dest.Id, opt => opt.MapFrom(src => src.ReaderApplicationId));             
        }
    }
}
